package pub.wkq.thread;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 王开琦
 */
public class CompletableMachina {
    public static void main(String[] args) {
        CompletableFuture<Machina> completableFuture = CompletableFuture.completedFuture(new Machina(0));
        try {
            Machina machina = completableFuture.get(); //不会阻塞
            System.out.println("machina = " + machina);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
    }
}
